﻿namespace Sidvall.Business
{
    public class BusinessCollectionSettings
    {
        #region Public Members

        public BusinessCollectionEvents EnabledBusinessCollectionEvents { get; set; }
        public bool MarkAsDeleted { get; set; }

        #region Copy

        public BusinessCollectionSettings Copy()
        {
            var item = new BusinessCollectionSettings();
            item.Import(this);
            return item;
        }

        #endregion
        #region Import

        public void Import(BusinessCollectionSettings item)
        {
            if (item == null)
                return;
            this.EnabledBusinessCollectionEvents = item.EnabledBusinessCollectionEvents;
            this.MarkAsDeleted = item.MarkAsDeleted;
        }

        #endregion
        #region ToString

        public override string ToString()
        {
            return this.EnabledBusinessCollectionEvents.ToString();
        }

        #endregion

        #endregion
        #region Factory Members

        public static BusinessCollectionSettings CreateSettings(BusinessCollectionEvents enabledEvents)
        {
            return CreateSettings(enabledEvents, true);
        }
        public static BusinessCollectionSettings CreateSettings(BusinessCollectionEvents enabledEvents, bool markAsDeleted)
        {
            return new BusinessCollectionSettings()
            {
                EnabledBusinessCollectionEvents = enabledEvents,
                MarkAsDeleted = markAsDeleted,
            };
        }
        public static BusinessCollectionSettings CreateSettingsAll()
        {
            return CreateSettingsAll(true);
        }
        public static BusinessCollectionSettings CreateSettingsAll(bool markAsDeleted)
        {
            return new BusinessCollectionSettings()
            {
                EnabledBusinessCollectionEvents = BusinessCollectionEvents.All,
                MarkAsDeleted = markAsDeleted,
            };
        }
        public static BusinessCollectionSettings CreateSettingsNone()
        {
            return CreateSettingsNone(true);
        }
        public static BusinessCollectionSettings CreateSettingsNone(bool markAsDeleted)
        {
            return new BusinessCollectionSettings()
            {
                EnabledBusinessCollectionEvents = BusinessCollectionEvents.None,
                MarkAsDeleted = markAsDeleted,
            };
        }

        #endregion
    }
}
